import Vue from 'vue'

// import Cookies from 'js-cookie'

import 'normalize.css/normalize.css'

import Element from 'element-ui'

//

// 数据字典
import dict from './components/Dict'

// 权限指令
import permission from './components/Permission'
import './assets/styles/element-variables.scss'
// global css
import './assets/styles/index.scss'
// import './utils/error-log'
// 代码高亮（已卸载）
// import VueHighlightJS from 'vue-highlightjs'
// import 'highlight.js/styles/atom-one-dark.css'
// 兄弟组件传值
import { protoUtils } from './utils/dataTransfer'
protoUtils(Vue)
// 引入自己封装的ui组件,按需加载
import semiUi from './modules/semiUi'
Vue.use(semiUi, { component: [
  'semiFormItem', 'myTable', 'Pagination', 'Btnpermission', 'dynTable', 'InfoCard',
  'DynForm'
] })

import checkPermission from '@/utils/permission'
Vue.prototype.$checkPermission = checkPermission

import debounce from '@/directive/debounce'
import throttle from '@/directive/throttle'
import btnPermission from '@/directive/btnPermission'
import enterFocus from '@/directive/enter-focus'
Vue.directive('btnDebounce', debounce)
Vue.directive('btnThrottle', throttle)
Vue.directive('btnPermission', btnPermission)
Vue.directive('enterFocus', enterFocus)

import App from './App'
import store from './store'
import router from './router/routers'
import EVueContextmenu from 'e-vue-contextmenu'
Vue.use(EVueContextmenu)

import i18n from '@/locale'
Vue.use(Element, {
  i18n: (key, value) => {
    const v = i18n.t(key, value)
    if (v !== null && v !== undefined) {
      return v
    }
    return ''
  }
})

import './assets/icons' // icon
import './router/index' // permission control
// import 'echarts-gl'  (暂定)
// Vue.use(VueHighlightJS)
// Vue.use(mavonEditor)
Vue.use(permission)
Vue.use(dict)
Vue.use(Element)
// Vue.use(Element, {
//   size: Cookies.get('size') || 'small' // set element-ui default size
// })
Vue.use(Element, {
  size: 'medium' // set element-ui default size
})

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  i18n,
  store,
  render: h => h(App)
})
